



'''
from haystack import Document
from haystack.components.rankers import SentenceTransformersDiversityRanker

ranker = SentenceTransformersDiversityRanker(model="sentence-transformers/all-MiniLM-L6-v2", similarity="cosine")
ranker.warm_up()

docs = [Document(content="Regular Exercise"), Document(content="Balanced Nutrition"), Document(content="Positive Mindset"), 
        Document(content="Eating Well"), Document(content="Doing physical activities"), Document(content="Thinking positively")]
        
query = "How can I maintain physical fitness?"
output = ranker.run(query=query, documents=docs,top_k=1)
docs = output["documents"]

print(docs)

# 使用 Xenova/ms-marco-MiniLM-L-6-v2
from haystack import Document
from haystack_integrations.components.rankers.fastembed import FastembedRanker

docs = [Document(content="Paris"), Document(content="Berlin")]

ranker = FastembedRanker()
ranker.warm_up()

output=ranker.run(query="City in France", documents=docs, top_k=2)
print(output)
'''